package cloud.kiko.psn.order.service;

import cloud.kiko.psn.pojo.common.biz.User;
import cloud.kiko.psn.feign.rmi.UserRMI;
import cloud.kiko.psn.order.mapper.OrderMapper;
import cloud.kiko.psn.order.pojo.Order;
import cloud.kiko.psn.pojo.common.R;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * on 2023/2/13 0:18
 */
@Service
public class OrderService{
	@Resource
	private OrderMapper orderMapper;
	
	@Resource
	private UserRMI userRMI;
	
	public Order getOrderById(long id){
		Order order = orderMapper.findById(id);
		if(order != null){
			R<User> r = userRMI.findById(order.getUserId());
			if(r!=null){
				order.setUser(r.getData());
			}
		}
		return order;
	}
}
